package com.bestcem.xm.member.service;

import com.bestcem.xm.common.core.domain.web.ServiceResult;
import com.bestcem.xm.member.grpc.service.param.syncrule.BatchUpdateSyncRuleParam;
import com.bestcem.xm.member.grpc.service.param.syncrule.CreateSyncRuleParam;
import com.bestcem.xm.member.grpc.service.param.syncrule.GetSyncRuleParam;
import com.bestcem.xm.member.grpc.service.param.syncrule.UpdateSyncRuleParam;
import com.bestcem.xm.member.service.dto.SyncRuleDTO;

import java.util.List;
import java.util.Map;

/**
 * @author ming.xue <ming.xue@idiaoyan.com>
 * @desc 同步规则服务
 * @date 2021-08-02
 */
public interface SyncRuleService {
    /**
     * 获取同步规则
     *
     * @param param
     * @return
     */
    ServiceResult<SyncRuleDTO> getSyncRule(GetSyncRuleParam param);

    /**
     * 创建同步规则
     *
     * @param param
     * @return
     */
    ServiceResult<String> createSyncRule(CreateSyncRuleParam param);

    /**
     * 修改同步规则
     *
     * @param param
     * @return
     */
    ServiceResult<SyncRuleDTO> updateSyncRule(UpdateSyncRuleParam param);

    /**
     * 获取同步规则默认字段列表
     *
     * @param memberType
     * @return
     */
    ServiceResult<Map<String, List<String[]>>> listDefaultSyncRuleFields(Integer memberType);

    /**
     * 重置同步规则
     *
     * @param id
     * @return
     */
    ServiceResult<SyncRuleDTO> restoreSyncRule(String id);

    /**
     * 批量修改同步规则
     *
     * @param param
     * @return
     */
    ServiceResult<Void> batchUpdateSyncRule(BatchUpdateSyncRuleParam param);

    /**
     * 刷新本地缓存
     *
     * @param orgId
     * @param memberType
     * @param type
     */
    void flushRedisCache(String orgId, Integer memberType, Integer type);

    /**
     * 获取同步类型
     *
     * @param orgId
     * @param index
     * @return
     */
    Integer get(String orgId, int index);
}
